// pages/activity/tree/rank.js
Page({
  data: {
    bottomHeight: getApp().globalData.bottomHeight,
    list: [],
    page: 1,
    size: 10,
    isNoMore: true,
    isLoding: true
  },
  onLoad(options) {
    this.getList();
  },
  onPullDownRefresh: function () {
    wx.showNavigationBarLoading();
    this.setData({
      list: [],
      page: 1,
      size: 10,
      isNoMore: true,
      isLoding: true
    });
    this.getList();
  },
  onReachBottom() {
    if (this.data.isNoMore) {
      this.setData({
        page: this.data.page / 1 + 1,
        isLoding: false
      });
      this.getList();
    }
  },
  onShareAppMessage() {},
  getList() {
    getApp().globalData.http.tree_rank({
      page: this.data.page,
      size: this.data.size,
    }).then(res => {
      this.setData({
        list: res.data,
        isLoding: true
      });
      if (this.data.list.length == res.count) {
        this.setData({
          isNoMore: false
        });
      }
      wx.hideNavigationBarLoading();
      wx.stopPullDownRefresh();
    });
  },
})